//
//  XH12TableViewCell.m
//  Big Show
//
//  Created by 赵晓航 on 15-5-20.
//  Copyright (c) 2015年 Big_Q. All rights reserved.
//

#import "XH12TableViewCell.h"
#import "UIImageView+WebCache.h"

@interface XH12TableViewCell ()

@property (nonatomic, retain) UILabel *label;
@property (nonatomic, retain) UIImageView *img;




@end


@implementation XH12TableViewCell


- (void)dealloc
{
    [_img release];
    [_label release];
    [super dealloc];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.label = [[UILabel alloc] init];
//        _label.backgroundColor = [UIColor lightGrayColor];
        _label.numberOfLines = 0;
        _label.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_label];
        _label.textColor = [UIColor blackColor];
        [_label sizeToFit];
        [_label release];
        
        self.img = [[UIImageView alloc] init];
//        _img.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_img];
        [_img release];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _label.frame = CGRectMake(10, 15, self.contentView.frame.size.width *0.6, self.contentView.frame.size.height * 0.3);
    _img.frame = CGRectMake(_label.frame.size.width + 10, 15, self.contentView.frame.size.width - _label.frame.size.width - 15, self.contentView.frame.size.height * 0.8);
}


- (void)setDic:(NSMutableDictionary *)dic
{
    if (_dic != dic) {
        [_dic release];
        _dic = [dic retain];
    }
    _label.text = [_dic objectForKey:@"title"];
    
    NSString *strrr = [NSString stringWithFormat:@"http://i3.go2yd.com/image.php?type=thumbnail_180x120&url=%@&net=wifi", [_dic objectForKey:@"image"]];
    
    [_img sd_setImageWithURL:[NSURL URLWithString:strrr] placeholderImage:[UIImage imageNamed:@"占位图.jpg"]];
    
}











- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
